package com.fan.txl.data.feed;

import android.databinding.BaseObservable;
import android.databinding.Bindable;
import android.databinding.repacked.apache.commons.io.output.StringBuilderWriter;
import android.os.Parcel;
import android.os.Parcelable;

import com.fan.txl.BR;
import com.fan.txl.data.contact.Contact;

import java.util.Date;


/**
 * Created by os on 2017/5/2.
 * Title
 */

public class Feed extends BaseObservable implements Parcelable {
    String id;
    String accountId;
    String feedMobile;
    String feedName;
    String feed;
    String whereIs;
    String geo;
    String background;
    Date   createTime;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getAccountId() {
        return accountId;
    }

    public void setAccountId(String accountId) {
        this.accountId = accountId;
    }
    @Bindable
    public String getFeedMobile() {
        return feedMobile;
    }

    public void setFeedMobile(String feedMobile) {
        this.feedMobile = feedMobile;
        notifyPropertyChanged(BR.feedMobile);
    }
    @Bindable
    public String getFeedName() {
        return feedName;
    }

    public void setFeedName(String feedName) {
        this.feedName = feedName;
        notifyPropertyChanged(BR.feedName);
    }

    public String getBackground() {
        return background;
    }

    public void setBackground(String background) {
        this.background = background;
    }
    @Bindable
    public String getFeed() {
        return feed;
    }

    public void setFeed(String feed) {
        this.feed = feed;
        notifyPropertyChanged(BR.feed);
    }
    @Bindable
    public String getWhereIs() {
        return whereIs;
    }

    public void setWhereIs(String whereIs) {
        this.whereIs = whereIs;
        notifyPropertyChanged(BR.whereIs);
    }
    @Bindable
    public String getGeo() {
        return geo;
    }

    public void setGeo(String geo) {
        this.geo = geo;
        notifyPropertyChanged(BR.geo);
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
/*@Bindable
    public Contact getContact() {
        return contact;
    }

    public void setContact(Contact contact) {
        this.contact = contact;
        notifyPropertyChanged(BR.contact);
    }
    @Bindable
    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
        notifyPropertyChanged(BR.content);
    }*/


    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(this.id);
        dest.writeString(this.accountId);
        dest.writeString(this.feedMobile);
        dest.writeString(this.feedName);
        dest.writeString(this.feed);
        dest.writeString(this.whereIs);
        dest.writeString(this.geo);
        dest.writeString(this.background);
        dest.writeLong(this.createTime != null ? this.createTime.getTime() : -1);
    }

    public Feed() {
    }

    protected Feed(Parcel in) {
        this.id = in.readString();
        this.accountId = in.readString();
        this.feedMobile = in.readString();
        this.feedName = in.readString();
        this.feed = in.readString();
        this.whereIs = in.readString();
        this.geo = in.readString();
        this.background = in.readString();
        long tmpCreateTime = in.readLong();
        this.createTime = tmpCreateTime == -1 ? null : new Date(tmpCreateTime);
    }

    public static final Creator<Feed> CREATOR = new Creator<Feed>() {
        @Override
        public Feed createFromParcel(Parcel source) {
            return new Feed(source);
        }

        @Override
        public Feed[] newArray(int size) {
            return new Feed[size];
        }
    };
}
